package com.qf.service;

import com.qf.dto.TProductSearchDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author LiuLiang
 * @Date 2020/3/16
 */
@Service
public class SearchService {
    @Autowired
    private RestTemplate restTemplate;

    public List<TProductSearchDTO> searchGoodsByKeywords(String keywords, Integer pageNum, Integer pagesize){
        return restTemplate.getForObject("http://spring-cloud-service-search/search?keywords=" +
                keywords+"&pageNum="+pageNum+"&pagesize="+pagesize,List.class);
    }

    public void initDataToSolr() {
        restTemplate.getForObject("http://spring-cloud-service-search/initData",String.class);
    }

}
